package com.ict.start;

import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
 * Created by chenlong on 2017/10/9.
 * Info:
 */
public class Lvdiantu {
    public static boolean excuteCmd(String cmdstr) {
        String[] cmd = new String[]{
                "cmd.exe", "/C", cmdstr};
        BufferedReader br = null;
        String line = null;

        Runtime runtime = Runtime.getRuntime();
        try {
            Process pro = runtime.exec(cmd);
            StringBuffer sbOut = new StringBuffer(1000);
            br = new BufferedReader(new InputStreamReader(pro.getInputStream()));

            if((line = br.readLine()) != null){
//                System.out.println(line);
//                String[] sourceStrArray=line.split(":");
//                System.out.println(sourceStrArray[0]+"="+sourceStrArray[1]);
//                if(sourceStrArray[0].equals("Status")&&sourceStrArray[1].equals("SUCCESS")){
//                    return true;
//                }else{
//                    return false;
//                }
            }
            return true;
        } catch (Exception e) {
            System.out.println("Excute Error:" + e);
            return false;
        }
    }

//    public static void main(String[] args) {
//        String fileRoad="C:\\ict\\AisPos\\lvdiantu\\Distribution.exe";
//        String fileRoad2="G:\\Install_software\\CloudMusic\\cloudmusic.exe";
//        excuteCmd(fileRoad);
//    }
}
